const app =getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    type:2,
    list:[],
    longUID:0,
    intPageSize:20,
    intCurrPage:1,
    intPageCount:1,
    moreno:false,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      longUID:options.longUID,
    })
    this.getGyList();
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    if (this.data.intCurrPage < this.data.intPageCount) {
      this.setData({
        intCurrPage:this.data.intCurrPage+1
      })
      this.getGyList();
    }else{
      this.setData({
        moreno:true
      })
    }
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  //type == 1 供应信息
  //type == 2 求购信息
  getGyList:function () {
    var that = this;
    var url = 'api/FeijiuApp/GetShopGqList?longUID='+this.data.longUID+'&type='+this.data.type+'&intCurrPage='+this.data.intCurrPage+'&intPageSize='+this.data.intPageSize+'&strRSA=';
    app.getDaoGet(url,function (r) {
      if (r.code == 200) {
        for (var i = 0; i < r.data.List.length; i++) {
          var photoss = app.photoSplitOne(r.data.List[i].photo);
          if (photoss == '') {
             r.data.List[i].photoOne = that.data.nopic;
          }else{
             r.data.List[i].photoOne = photoss;
          }
        }
        var words = that.data.list.concat(r.data.List);
        that.setData({
          list:words,
          intPageCount:r.data.intPageCount
        })
       console.log(r)
      }
    })
  },   
})